home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / CRACKX.ASM < prev    next >
Encoding:
Assembly Source File  |  1999-01-28  |  3.5 KB  |  243 lines

  1. ;
  2. ;    Keyfile finder. 32 bit pentium optimized code for dos4gw.
  3. ;    You'll need a Microsoft Assembler 6.0 and Watcom Linker to
  4. ;    build the executable. Use the makeex.bat co compile.
  5. ;    Don't forget to set right path in dos4gw.lnk
  6. ;
  7. ;    this programm takes about 4 hours on p200
  8.  
  9.     .486
  10.     .model flat
  11.  
  12. _TEXT   segment use32 dword public 'CODE'
  13.         assume  cs:_TEXT,ds:_DATA
  14.  
  15.  
  16. start:
  17.     jmp _main
  18.     db 'WATCOM'    
  19.  
  20. _main:
  21.     mov ax,3
  22.     int 10h
  23.     
  24.     push ds
  25.     pop es
  26.     
  27.     mov ax,0
  28.     mov cx,2
  29.     int 31h
  30.     mov ax,2
  31.     mov bx,0B800h
  32.     int 31h
  33.     mov gs,ax
  34.     assume gs:nothing
  35.     
  36.     call InitMagic32
  37.  
  38.     lea edx,msg1
  39.     mov ah,9
  40.     int 21h
  41.  
  42.     
  43.     
  44.     lea edi,Table
  45.     xor ecx,ecx
  46.     
  47.     @st equ 12345678h
  48. @f10:
  49.     push ecx
  50.     lea esi,Key
  51.     mov eax,ecx
  52.     shl eax,16
  53.     mov ebx,@st
  54.     mov ebp,0
  55.     mov ecx,0FDh-8
  56. @f11:
  57.     push ecx
  58.         movsx cx,byte ptr [esi]
  59.         mov ax,[esi+1]
  60.         inc esi
  61.         mul cx
  62.         mov cl,[esi+2]
  63.         @@1:
  64.         rol eax,cl
  65.         xor ebx,eax
  66.         xchg eax,ecx
  67.         rol ebx,cl
  68.         add ebp,ecx
  69.         xchg eax,ecx
  70.         not eax
  71.         loop @@1    
  72.     pop ecx
  73.     loop @f11
  74.         
  75.     mov ecx,ebp
  76.     and cl,31
  77.     ror ebx,cl
  78.     xor ebx,@st
  79.     mov [edi],cl
  80.     mov [edi+1],ebx
  81.     add edi,5
  82.     pop ecx
  83.     inc cl
  84.     jnz @f10
  85.     inc ch
  86.     mov gs:[0],ch
  87.     jnz @f10
  88.     
  89.     lea edx,msg2
  90.     mov ah,9
  91.     int 21h
  92.  
  93.     mov _eax,eax
  94.         
  95.  
  96.     xor eax,eax
  97.     xor edx,edx
  98.     lea esi,Key
  99.  
  100.     mov cx, 256-8
  101. @f3:    mov al,[esi]
  102.     inc esi
  103.     xor al,dl
  104.     shr edx,8
  105.     xor edx,Magic32[eax*4]
  106.     loop @f3
  107.     
  108.     mov Crc32,edx
  109.     
  110.     mov ecx,0
  111. @e2:
  112.     push ecx
  113.     
  114.     mov edx,Crc32
  115.     xor eax,eax
  116.     lea esi,Key+256-8
  117.  
  118. REPT 8
  119.     mov al,cl
  120.         shr ecx,4
  121.     and al,15
  122.         mov bl,dl
  123.     inc eax
  124.         shr edx,8
  125.     mov [esi],al
  126.         xor al,bl
  127.     inc esi
  128.         xor edx,Magic32[eax*4]
  129. ENDM
  130.  
  131.     mov eax,edx
  132.         mov ebx,edx
  133.  
  134.     shr eax,16
  135.         mov _crc32,edx    
  136.  
  137.     mov cl,Table[eax*4+eax]
  138.     xor ebx,dword ptr Table[eax*4+eax+1]
  139.     lea esi, Key+0FDh-8
  140.     rol ebx,cl
  141.         
  142.     mov eax,_eax
  143.  
  144.     xor ecx,ecx
  145.     REPT 8
  146.         local @@1
  147.         mov   cl,byte ptr [esi]
  148.         mov     ax,[esi+1]
  149.         mul cx
  150.         inc    esi
  151.         mov cl,[esi+2]    
  152.         @@1:
  153.         rol    eax, cl
  154.         xor    ebx, eax
  155.         xchg ecx,eax
  156.         rol    ebx, cl
  157.         xchg ecx,eax
  158.         not    eax
  159.         loop @@1
  160.     ENDM
  161.  
  162.     cmp    ebx,0A69EC24Eh
  163.     jz    @ok
  164.     
  165.     pop ecx
  166.     inc cx
  167.     jnz @e2
  168.     mov eax,ecx
  169.     shr eax,16
  170.     mov byte ptr gs:[160],ah
  171.     mov byte ptr gs:[162],al
  172.     add ecx,10000h
  173.     jnz @e2
  174.     
  175.     mov ah,4Ch
  176.     int 21h    
  177.     
  178. @ok:
  179.     lea edx,fname
  180.     mov eax,3C00h
  181.     xor ecx,ecx
  182.     int 21h
  183.     xchg eax,ebx
  184.     lea edx,Key
  185.     mov ecx,256
  186.     mov ah,40h
  187.     int 21h
  188.     mov ah,3Eh
  189.     int 21h
  190.     mov ah,4Ch
  191.     int 21h
  192.  
  193.     Magicon        equ 0edb88320h
  194.     
  195. InitMagic32:
  196.                 std
  197.                 mov     edi,OFFSET Magic32+0400h-4    ; Last WORD of the array
  198.                 mov     edx,0FFh
  199. im0:            mov     ecx,8
  200.                 mov    eax,edx
  201. im1:            shr     eax,1
  202.                 jnc     im2
  203.                 xor     eax,Magicon
  204. im2:            loop    im1
  205.                 stosd
  206.                 dec     edx
  207.                 jns     im0
  208.                 cld
  209.                 ret
  210.     
  211. _TEXT   ends
  212.  
  213. _DATA   segment use32 dword public 'DATA'
  214.  
  215. Key    db 13,10,"---=== Keyfile generated by Ak Kort [SOS group] ===---"
  216.     db 13,10," http://www.sos.nanko.ru   e-mail: sos@russiamail.com "
  217.     db 13,10,13,10    
  218.     db 13,10,13,10    
  219.     db 256-($-offset Key) dup(1)
  220.  
  221. msg1    db '   Precalculating 65536 masks...',13,10,36
  222. msg2    db '   Cracking...',13,10,36
  223. fname    db '-ok-',0
  224.  
  225. align 4
  226. _eax    dd ?
  227. Crc32    dd ?
  228.  
  229. Magic32    dd 256 dup(?)
  230. _crc32    dd ?
  231.  
  232.     Table    db 5*65536 dup(?)    
  233. _DATA   ends
  234.  
  235. stack   segment para stack 'STACK'
  236.         db 2000h dup(?)
  237. stack   ends
  238.  
  239. end
  240.  
  241. end start
  242.         
  243.